import React from 'react';
import { Row, Col, Table } from 'antd';
import Actions from 'src/components/Actions';

export default function ActionLog(props) {
  const { name, logs = {}, value, actions } = props;
  const { variables } = logs;
  const condition_actions = [{ actions: value }];
  const isHasLog = Object.keys(logs).length > 0;

  const actionColums = [
    {
      title: '命中状态',
      dataIndex: 'action_type',
      render: () => {
        return '命中';
      },
    },
    {
      title: '动作',
      dataIndex: 'actions',
      render: (text) => {
        return (
          <Actions {...props} variables={variables} value={text} disabled={true} isHit={isHasLog} actions={actions} />
        );
      },
    },
  ];
  return (
    <div>
      <Row type='flex' style={{ lineHeight: '3' }} gutter={100}>
        <Col>
          <div className='tantuer-form-item2'>
            <div className='ant-form-item-label'>
              <label>节点名称</label>
            </div>
            <span>{name}</span>
          </div>
        </Col>
      </Row>
      <Table columns={actionColums} dataSource={condition_actions} rowKey='id' pagination={false} />
    </div>
  );
}
